<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Attribute extends Model
{
    protected $fillable = ['name','attr','uniqueid','sort','parent_id','attr_type','map','status','longitude','latitude'];

    //子分类
    public function childs()
    {
        return $this->hasMany('App\Models\Attribute','parent_id','id');
    }

    //所有子类
    public function allChilds()
    {
        return $this->childs()->with('allChilds');
    }


}
